package com.carefree.bookmall.entity;

import java.io.Serializable;
import java.util.Objects;

/**
 * 用户角色关联
 *
 * @author qianyue
 * @email qianyue1226@gmail.com
 * @date 2022-03-21 20:11:28
 */
public class UserRole implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Integer id;
    /**
     * 用户id
     */
    private Integer userId;
    /**
     * 角色id
     */
    private Integer roleId;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (! (o instanceof UserRole)) return false;
        UserRole userRole = (UserRole) o;
        return Objects.equals(getId(), userRole.getId()) && Objects.equals(getUserId(), userRole.getUserId()) && Objects.equals(getRoleId(), userRole.getRoleId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getUserId(), getRoleId());
    }

    @Override
    public String toString() {
        return "UserRole{" +
                "id=" + id +
                ", userId=" + userId +
                ", roleId=" + roleId +
                '}';
    }
}
